package com.dhsc.service.impl.khzne;

import com.dhsc.domain.ywzx.khzne.XmjsdkhVo;
import com.dhsc.domain.yypt.LayuiTableVo;
import com.dhsc.exception.MyException;
import com.dhsc.local.dao.ywzj.khzne.IXmjsdkhDao;
import com.dhsc.service.khzne.IXmjsdkhService;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 休眠及锁定客户
 * @date 2024/11/28 15:33
 */
@Service
@Slf4j
public class IXmjsdkhServiceImpl implements IXmjsdkhService {

    @Autowired
    private IXmjsdkhDao xmjsdkhDao;

    @Override
    public LayuiTableVo queryXmjsdkhinfo(XmjsdkhVo x) {
        LayuiTableVo obj = new LayuiTableVo();
        try {
            PageMethod.startPage(x.getPage(), x.getLimit());
            List<XmjsdkhVo> list = xmjsdkhDao.queryXmjsdkhinfo(x);
            PageInfo<XmjsdkhVo> pageInfo = new PageInfo<>(list);
            obj.setData(list);
            obj.setMsg("");
            obj.setCount(pageInfo.getTotal());
            obj.setCode(0);
        }catch (Exception e){
            log.error("查询休眠及锁定客户信息出错",e);
            throw new MyException("查询休眠及锁定客户信息出错",e);
        }
        return obj;
    }
}
